<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:a4j="http://richfaces.org/a4j"
	template="/layout/template.xhtml">
    
<ui:define name="body">
    
    <style>
		.active-row {
		    background-color: #FFEBDA;
		}
	</style>
    <h:form>
        <script type="text/javascript">
            var row;
        </script>
        <rich:contextMenu attached="false" id="menu" submitMode="ajax" oncollapse="row.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
            <rich:menuItem value="Edit Record" ajaxSingle="true"
                oncomplete="#{rich:component('editPanel')}.show()"
                >
                <a4j:actionparam name="vin" value="{carVin}" />
                <a4j:actionparam name="row" value="{currentRow}" />
            </rich:menuItem>
            <rich:menuItem value="Remove Record" ajaxSingle="true"
                oncomplete="#{rich:component('deletePanel')}.show()"
                >
                <a4j:actionparam name="vin" value="{carVin}" />
                <a4j:actionparam name="row" value="{currentRow}" />
            </rich:menuItem>
        </rich:contextMenu>
        <a4j:region>
            <rich:dataTable value="#{consultaAction.consultas}"
                var="category" rows="20" rowKeyVar="row"
                id="table">
                <f:facet name="header">
                    <h:outputText value="Cars Store" />
                </f:facet>
                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="Make" />
                    </f:facet>
                    <h:outputText value="#{category.observacoes}" id="make" />
                </rich:column>
               
                <rich:column>
                    <f:facet name="header">
                        Actions
                </f:facet>
                    <a4j:commandLink ajaxSingle="true" id="editlink"
                        oncomplete="#{rich:component('editPanel')}.show()">
                        <h:graphicImage value="/images/icons/edit.gif" style="border:0" />
                    </a4j:commandLink>
                    <rich:toolTip for="editlink" value="Edit" />
                    <a4j:commandLink ajaxSingle="true" id="deletelink"
                        oncomplete="#{rich:component('deletePanel')}.show()">
                        <h:graphicImage value="/images/icons/delete.gif" style="border:0" />
                    </a4j:commandLink>
                    <rich:toolTip for="deletelink" value="Delete" />
                </rich:column>
                <f:facet name="footer">
                    <rich:datascroller renderIfSinglePage="false" maxPages="5" />
                </f:facet>
            </rich:dataTable>
        </a4j:region>
    </h:form>

    <rich:modalPanel id="editPanel" autosized="true" width="450">
        <f:facet name="header">
            <h:outputText value="Edit Current Car" />
        </f:facet>
        <f:facet name="controls">
            <h:panelGroup>
                <h:graphicImage value="/images/modal/close.png" id="hidelink"
                    styleClass="hidelink" />
                <rich:componentControl for="editPanel" attachTo="hidelink"
                    operation="hide" event="onclick" />
            </h:panelGroup>
        </f:facet>
        <h:form>
            <rich:messages style="color:red;"></rich:messages>
            
        </h:form>
    </rich:modalPanel>
    <rich:modalPanel id="deletePanel" autosized="true" width="200">
        <f:facet name="header">
            <h:outputText value="Delete this car from list?"
                style="padding-right:15px;" />
        </f:facet>
        <f:facet name="controls">
            <h:panelGroup>
                <h:graphicImage value="/images/modal/close.png"
                    styleClass="hidelink" id="hidelink2" />
                <rich:componentControl for="deletePanel" attachTo="hidelink2"
                    operation="hide" event="onclick" />
            </h:panelGroup>
        </f:facet>
        
    </rich:modalPanel>
    <a4j:status onstart="#{rich:component('wait')}.show()"
        onstop="#{rich:component('wait')}.hide()" />
    <rich:modalPanel id="wait" autosized="true" width="200" height="120"
        moveable="false" resizeable="false">
        <f:facet name="header">
            <h:outputText value="Processing" />
        </f:facet>
        <h:outputText value="Wait Please..." />
    </rich:modalPanel>
    <rich:messages></rich:messages>

</ui:define>
</ui:composition>